/*
 * File: Fu_RotAngObs.c
 *
 * Code generated for Simulink model 'Fu_RotAngObs'.
 *
 * Model version                  : 1.496
 * Simulink Coder version         : 8.2 (R2012a) 29-Dec-2011
 * TLC version                    : 8.2 (Dec 29 2011)
 * C/C++ source code generated on : Sat Jun 08 20:33:25 2013
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: ARM Compatible->ARM Cortex
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "Fu_RotAngObs.h"
#include "Fu_RotAngObs_private.h"

/* Named constants for Chart: '<S3>/Fu_RotAngObs_Hallsensor_Calc' */
#define Fu_RotAngObs_IN_Lerned         ((uint8_T)1U)
#define Fu_RotAngObs_IN_NotLerned      ((uint8_T)2U)

/* Named constants for Chart: '<S1>/Fu_RotAngObs_StatesMachine' */
#define Fu_RotAngObs_IN_ANG_LERNING    ((uint8_T)1U)
#define Fu_RotAngObs_IN_ANG_OK         ((uint8_T)2U)
#define Fu_RotAngObs_IN_IDLE           ((uint8_T)3U)

/* Exported block signals */
uint16_T AngObs_AngRamp;               /* '<S4>/Memory' */
uint16_T RotAngObs_AngHall;            /* '<S3>/Fu_RotAngObs_Hallsensor_Calc' */
uint16_T RotAngObs_AngMdl;             /* '<S2>/Memory' */
int16_T RotAngObs_SpdRaw;              /* '<S2>/MinMax' */
uint8_T RotAngObs_NRamp;               /* '<S4>/Memory2' */
uint8_T AngObs_StAngLern;              /* '<S1>/Fu_RotAngObs_StatesMachine' */
uint8_T Coord_IndRotPos;               /* '<S1>/Fu_RotAngObs_StatesMachine' */
boolean_T RotAngObs_FlgHallAngVld;     /* '<S3>/Logical Operator' */
boolean_T RotAngObs_FlgPosErrShtDwn;   /* '<S1>/Fu_RotAngObs_StatesMachine' */
boolean_T RotAngObs_FlgHallsensLernd;  /* '<S3>/Fu_RotAngObs_Hallsensor_Calc' */
boolean_T RotAngObs_FlgAngLernd;       /* '<S6>/Memory' */

/* Block states (auto storage) */
D_Work_Fu_RotAngObs Fu_RotAngObs_DWork;

/* Real-time model */
RT_MODEL_Fu_RotAngObs Fu_RotAngObs_M_;
RT_MODEL_Fu_RotAngObs *const Fu_RotAngObs_M = &Fu_RotAngObs_M_;

/* Model step function */
void Fu_RotAngObs_step(void)
{
  boolean_T rtb_RelationalOperator_f;
  int16_T rtb_loc_RotAngObs_MaxPossibleSp;
  uint16_T rtb_Add_k;
  int16_T rtb_Add1;
  int16_T rtb_Add2;
  uint32_T tmp;
  int32_T tmp_0;
  uint16_T tmp_1;

  /* Logic: '<S3>/Logical Operator' incorporates:
   *  Inport: '<Root>/In1'
   *  Inport: '<Root>/In2'
   *  Inport: '<Root>/In3'
   *  Memory: '<S3>/Memory'
   *  Memory: '<S3>/Memory1'
   *  Memory: '<S3>/Memory2'
   *  RelationalOperator: '<S3>/Relational Operator'
   *  RelationalOperator: '<S3>/Relational Operator1'
   *  RelationalOperator: '<S3>/Relational Operator2'
   */
  RotAngObs_FlgHallAngVld = ((Fu_RotAngObs_DWork.Memory_PreviousInput_ch !=
    Net_FlgHallSens1) || (Fu_RotAngObs_DWork.Memory1_PreviousInput_c !=
    Net_FlgHallSens2) || (Fu_RotAngObs_DWork.Memory2_PreviousInput_m !=
    Net_FlgHallSens3));

  /* Memory: '<S4>/Memory' */
  AngObs_AngRamp = Fu_RotAngObs_DWork.Memory_PreviousInput;

  /* Memory: '<S4>/Memory2' */
  RotAngObs_NRamp = Fu_RotAngObs_DWork.Memory2_PreviousInput_o;

  /* Chart: '<S3>/Fu_RotAngObs_Hallsensor_Calc' incorporates:
   *  Inport: '<Root>/In1'
   *  Inport: '<Root>/In2'
   *  Inport: '<Root>/In3'
   */
  /* Gateway: Fu_RotAngObs/Fu_RotAngObs_Hallsensors/Fu_RotAngObs_Hallsensor_Calc */
  /* During: Fu_RotAngObs/Fu_RotAngObs_Hallsensors/Fu_RotAngObs_Hallsensor_Calc */
  if (Fu_RotAngObs_DWork.is_active_c2_Fu_RotAngObs == 0) {
    /* Entry: Fu_RotAngObs/Fu_RotAngObs_Hallsensors/Fu_RotAngObs_Hallsensor_Calc */
    Fu_RotAngObs_DWork.is_active_c2_Fu_RotAngObs = 1U;

    /* Entry Internal: Fu_RotAngObs/Fu_RotAngObs_Hallsensors/Fu_RotAngObs_Hallsensor_Calc */
    /* Transition: '<S8>:3' */
    RotAngObs_FlgHallsensLernd = FALSE;
    Fu_RotAngObs_DWork.is_c2_Fu_RotAngObs = Fu_RotAngObs_IN_NotLerned;

    /* Entry Internal 'NotLerned': '<S8>:1' */
    /* Transition: '<S8>:45' */
    if (RotAngObs_FlgHallAngVld) {
      /* Transition: '<S8>:15' */
      Fu_RotAngObs_DWork.Loc_TblHallsens[(int32_T)Net_FlgHallSens1 | (int32_T)
        Net_FlgHallSens2 << 1 | (int32_T)Net_FlgHallSens3 << 2] = AngObs_AngRamp;
      RotAngObs_AngHall = AngObs_AngRamp;

      /* Transition: '<S8>:44' */
    } else {
      /* Transition: '<S8>:22' */
      /* Transition: '<S8>:23' */
    }
  } else if (Fu_RotAngObs_DWork.is_c2_Fu_RotAngObs == Fu_RotAngObs_IN_Lerned) {
    /* During 'Lerned': '<S8>:2' */
    RotAngObs_AngHall = Fu_RotAngObs_DWork.Loc_TblHallsens[(int32_T)
      Net_FlgHallSens2 << 1 | (int32_T)Net_FlgHallSens1 | (int32_T)
      Net_FlgHallSens3 << 2];
  } else {
    /* During 'NotLerned': '<S8>:1' */
    if ((RotAngObs_NRamp >= 25) && (Fu_RotAngObs_DWork.Loc_TblHallsens[1] !=
         65535) && (Fu_RotAngObs_DWork.Loc_TblHallsens[2] != 65535) &&
        (Fu_RotAngObs_DWork.Loc_TblHallsens[3] != 65535) &&
        (Fu_RotAngObs_DWork.Loc_TblHallsens[4] != 65535) &&
        (Fu_RotAngObs_DWork.Loc_TblHallsens[5] != 65535) &&
        (Fu_RotAngObs_DWork.Loc_TblHallsens[6] != 65535)) {
      /* Transition: '<S8>:25' */
      Fu_RotAngObs_DWork.is_c2_Fu_RotAngObs = Fu_RotAngObs_IN_Lerned;

      /* Entry 'Lerned': '<S8>:2' */
      RotAngObs_FlgHallsensLernd = TRUE;
    } else {
      /* Transition: '<S8>:46' */
      Fu_RotAngObs_DWork.is_c2_Fu_RotAngObs = Fu_RotAngObs_IN_NotLerned;

      /* Entry Internal 'NotLerned': '<S8>:1' */
      /* Transition: '<S8>:45' */
      if (RotAngObs_FlgHallAngVld) {
        /* Transition: '<S8>:15' */
        Fu_RotAngObs_DWork.Loc_TblHallsens[(int32_T)Net_FlgHallSens1 | (int32_T)
          Net_FlgHallSens2 << 1 | (int32_T)Net_FlgHallSens3 << 2] =
          AngObs_AngRamp;
        RotAngObs_AngHall = AngObs_AngRamp;

        /* Transition: '<S8>:44' */
      } else {
        /* Transition: '<S8>:22' */
        /* Transition: '<S8>:23' */
      }
    }
  }

  /* End of Chart: '<S3>/Fu_RotAngObs_Hallsensor_Calc' */

  /* Outputs for Enabled SubSystem: '<S1>/Fu_RotAngObs_AngObsv' incorporates:
   *  EnablePort: '<S2>/Enable'
   */
  if (RotAngObs_FlgHallsensLernd) {
    if (!Fu_RotAngObs_DWork.Fu_RotAngObs_AngObsv_MODE) {
      /* InitializeConditions for Memory: '<S2>/Memory' */
      Fu_RotAngObs_DWork.Memory_PreviousInput_c = 0U;

      /* InitializeConditions for Memory: '<S2>/Memory2' */
      Fu_RotAngObs_DWork.Memory2_PreviousInput = 0U;

      /* InitializeConditions for Memory: '<S2>/Memory3' */
      Fu_RotAngObs_DWork.Memory3_PreviousInput = 0;

      /* InitializeConditions for Memory: '<S2>/Memory1' */
      Fu_RotAngObs_DWork.Memory1_PreviousInput = 0;

      /* InitializeConditions for Memory: '<S7>/Memory' */
      Fu_RotAngObs_DWork.Memory_PreviousInput_i = FALSE;
      Fu_RotAngObs_DWork.Fu_RotAngObs_AngObsv_MODE = TRUE;
    }

    /* Memory: '<S2>/Memory' */
    RotAngObs_AngMdl = Fu_RotAngObs_DWork.Memory_PreviousInput_c;

    /* Sum: '<S2>/Add1' */
    rtb_Add_k = RotAngObs_AngHall;
    if (RotAngObs_AngHall > 32767) {
      rtb_Add_k = 32767U;
    }

    tmp_1 = RotAngObs_AngMdl;
    if (RotAngObs_AngMdl > 32767) {
      tmp_1 = 32767U;
    }

    rtb_Add1 = (int16_T)(rtb_Add_k - tmp_1);

    /* Product: '<S2>/Divide' incorporates:
     *  Memory: '<S2>/Memory2'
     */
    rtb_loc_RotAngObs_MaxPossibleSp = div_s16u32(10472U, (uint32_T)
      Fu_RotAngObs_DWork.Memory2_PreviousInput);

    /* Sum: '<S2>/Add2' incorporates:
     *  Memory: '<S2>/Memory1'
     *  Memory: '<S2>/Memory3'
     *  Product: '<S2>/Divide1'
     */
    tmp_0 = ((15 * Fu_RotAngObs_DWork.Memory1_PreviousInput >> 12) * 6711 >> 12)
      + Fu_RotAngObs_DWork.Memory3_PreviousInput;
    if (tmp_0 > 32767) {
      tmp_0 = 32767;
    } else {
      if (tmp_0 < -32768) {
        tmp_0 = -32768;
      }
    }

    /* MinMax: '<S2>/MinMax' incorporates:
     *  Sum: '<S2>/Add2'
     */
    if (rtb_loc_RotAngObs_MaxPossibleSp <= (int16_T)tmp_0) {
      RotAngObs_SpdRaw = rtb_loc_RotAngObs_MaxPossibleSp;
    } else {
      RotAngObs_SpdRaw = (int16_T)tmp_0;
    }

    /* End of MinMax: '<S2>/MinMax' */

    /* Sum: '<S2>/Add' */
    rtb_Add2 = RotAngObs_SpdRaw;
    if (RotAngObs_SpdRaw < 0) {
      rtb_Add2 = 0;
    }

    tmp = (uint32_T)rtb_Add2 + (uint32_T)RotAngObs_AngMdl;
    if (tmp > 65535U) {
      tmp = 65535U;
    }

    /* RelationalOperator: '<S7>/Relational Operator' incorporates:
     *  Memory: '<S7>/Memory'
     */
    rtb_RelationalOperator_f = ((int32_T)RotAngObs_FlgHallAngVld > (int32_T)
      Fu_RotAngObs_DWork.Memory_PreviousInput_i);

    /* Outputs for Enabled SubSystem: '<S2>/Fu_RotAngObs_AngLerndCrit' incorporates:
     *  EnablePort: '<S6>/Enable'
     */
    if (rtb_RelationalOperator_f) {
      /* Sum: '<S6>/Subtract' incorporates:
       *  DataTypeConversion: '<S6>/Data Type Conversion'
       *  DataTypeConversion: '<S6>/Data Type Conversion1'
       */
      rtb_Add2 = (int16_T)((int32_T)((uint32_T)RotAngObs_AngHall * 52429U >> 19)
                           - (int32_T)((uint32_T)RotAngObs_AngMdl * 52429U >> 19));

      /* Abs: '<S6>/Abs' */
      if (rtb_Add2 < 0) {
        rtb_Add2 = (int16_T)-rtb_Add2;
      }

      /* End of Abs: '<S6>/Abs' */

      /* Memory: '<S6>/Memory' */
      RotAngObs_FlgAngLernd = Fu_RotAngObs_DWork.Memory_PreviousInput_p;

      /* Switch: '<S6>/Switch' incorporates:
       *  RelationalOperator: '<S6>/Relational Operator'
       *  RelationalOperator: '<S6>/Relational Operator1'
       *  Switch: '<S6>/Switch1'
       */
      if (rtb_Add2 >= 200) {
        /* Update for Memory: '<S6>/Memory' incorporates:
         *  Constant: '<S6>/Constant1'
         */
        Fu_RotAngObs_DWork.Memory_PreviousInput_p = FALSE;
      } else if (rtb_Add2 < 50) {
        /* Switch: '<S6>/Switch1' incorporates:
         *  Constant: '<S6>/Constant3'
         *  Update for Memory: '<S6>/Memory'
         */
        Fu_RotAngObs_DWork.Memory_PreviousInput_p = TRUE;
      } else {
        /* Update for Memory: '<S6>/Memory' incorporates:
         *  Switch: '<S6>/Switch1'
         */
        Fu_RotAngObs_DWork.Memory_PreviousInput_p = RotAngObs_FlgAngLernd;
      }

      /* End of Switch: '<S6>/Switch' */
    }

    /* End of Outputs for SubSystem: '<S2>/Fu_RotAngObs_AngLerndCrit' */

    /* Switch: '<S2>/Switch3' incorporates:
     *  Switch: '<S2>/Switch4'
     */
    if (rtb_RelationalOperator_f) {
      /* Update for Memory: '<S2>/Memory2' incorporates:
       *  Constant: '<S2>/Constant7'
       */
      Fu_RotAngObs_DWork.Memory2_PreviousInput = 0U;

      /* Sum: '<S2>/Add4' incorporates:
       *  Memory: '<S2>/Memory3'
       *  Product: '<S2>/Divide2'
       *  Product: '<S2>/Divide3'
       */
      tmp_0 = ((rtb_loc_RotAngObs_MaxPossibleSp * 375 >> 10) * 6711 >> 12) +
        ((125 * Fu_RotAngObs_DWork.Memory3_PreviousInput >> 9) * 6711 >> 12);
      if (tmp_0 < -32768) {
        tmp_0 = -32768;
      }

      /* Update for Memory: '<S2>/Memory3' incorporates:
       *  Sum: '<S2>/Add4'
       */
      Fu_RotAngObs_DWork.Memory3_PreviousInput = (int16_T)tmp_0;
    } else {
      /* Update for Memory: '<S2>/Memory2' incorporates:
       *  Memory: '<S2>/Memory2'
       *  Sum: '<S2>/Add3'
       */
      Fu_RotAngObs_DWork.Memory2_PreviousInput = (uint16_T)(1U + (uint32_T)
        Fu_RotAngObs_DWork.Memory2_PreviousInput);
    }

    /* End of Switch: '<S2>/Switch3' */

    /* Switch: '<S2>/Switch1' incorporates:
     *  RelationalOperator: '<S2>/Relational Operator2'
     *  Sum: '<S2>/Add'
     */
    if (62832 <= (uint16_T)tmp) {
      /* Update for Memory: '<S2>/Memory' incorporates:
       *  Constant: '<S2>/Constant6'
       */
      Fu_RotAngObs_DWork.Memory_PreviousInput_c = 0U;
    } else {
      /* Update for Memory: '<S2>/Memory' */
      Fu_RotAngObs_DWork.Memory_PreviousInput_c = (uint16_T)tmp;
    }

    /* End of Switch: '<S2>/Switch1' */

    /* Abs: '<S2>/Abs' */
    if (rtb_Add1 < 0) {
      rtb_Add1 = (int16_T)-rtb_Add1;
    }

    /* End of Abs: '<S2>/Abs' */

    /* Switch: '<S2>/Switch2' incorporates:
     *  Logic: '<S2>/Logical Operator'
     *  RelationalOperator: '<S2>/Relational Operator'
     */
    if (rtb_RelationalOperator_f && (rtb_Add1 <= 30000)) {
      /* Update for Memory: '<S2>/Memory1' incorporates:
       *  Sum: '<S2>/Add1'
       */
      Fu_RotAngObs_DWork.Memory1_PreviousInput = (int16_T)(rtb_Add_k - tmp_1);
    }

    /* End of Switch: '<S2>/Switch2' */

    /* Update for Memory: '<S7>/Memory' */
    Fu_RotAngObs_DWork.Memory_PreviousInput_i = RotAngObs_FlgHallAngVld;
  } else {
    if (Fu_RotAngObs_DWork.Fu_RotAngObs_AngObsv_MODE) {
      Fu_RotAngObs_DWork.Fu_RotAngObs_AngObsv_MODE = FALSE;
    }
  }

  /* End of Outputs for SubSystem: '<S1>/Fu_RotAngObs_AngObsv' */

  /* Chart: '<S1>/Fu_RotAngObs_StatesMachine' incorporates:
   *  Inport: '<Root>/In7'
   */
  /* Gateway: Fu_RotAngObs/Fu_RotAngObs_StatesMachine */
  /* During: Fu_RotAngObs/Fu_RotAngObs_StatesMachine */
  if (Fu_RotAngObs_DWork.is_active_c1_Fu_RotAngObs == 0) {
    /* Entry: Fu_RotAngObs/Fu_RotAngObs_StatesMachine */
    Fu_RotAngObs_DWork.is_active_c1_Fu_RotAngObs = 1U;

    /* Entry Internal: Fu_RotAngObs/Fu_RotAngObs_StatesMachine */
    /* Transition: '<S5>:3' */
    Fu_RotAngObs_DWork.is_c1_Fu_RotAngObs = Fu_RotAngObs_IN_IDLE;

    /* Entry 'IDLE': '<S5>:2' */
    AngObs_StAngLern = 0U;
    RotAngObs_FlgPosErrShtDwn = TRUE;
    Coord_IndRotPos = 0U;
  } else {
    switch (Fu_RotAngObs_DWork.is_c1_Fu_RotAngObs) {
     case Fu_RotAngObs_IN_ANG_LERNING:
      /* During 'ANG_LERNING': '<S5>:6' */
      if (!Coord_FlgRdyForDrv) {
        /* Transition: '<S5>:8' */
        Fu_RotAngObs_DWork.is_c1_Fu_RotAngObs = Fu_RotAngObs_IN_IDLE;

        /* Entry 'IDLE': '<S5>:2' */
        AngObs_StAngLern = 0U;
        RotAngObs_FlgPosErrShtDwn = TRUE;
        Coord_IndRotPos = 0U;
      }
      break;

     case Fu_RotAngObs_IN_ANG_OK:
      /* During 'ANG_OK': '<S5>:9' */
      if (!RotAngObs_FlgHallsensLernd) {
        /* Transition: '<S5>:11' */
        RotAngObs_FlgPosErrShtDwn = FALSE;
        Fu_RotAngObs_DWork.is_c1_Fu_RotAngObs = Fu_RotAngObs_IN_ANG_LERNING;

        /* Entry 'ANG_LERNING': '<S5>:6' */
        AngObs_StAngLern = 1U;
        Coord_IndRotPos = 0U;
      } else {
        if (!Coord_FlgRdyForDrv) {
          /* Transition: '<S5>:12' */
          Fu_RotAngObs_DWork.is_c1_Fu_RotAngObs = Fu_RotAngObs_IN_IDLE;

          /* Entry 'IDLE': '<S5>:2' */
          AngObs_StAngLern = 0U;
          RotAngObs_FlgPosErrShtDwn = TRUE;
          Coord_IndRotPos = 0U;
        }
      }
      break;

     default:
      /* During 'IDLE': '<S5>:2' */
      if (Coord_FlgRdyForDrv) {
        /* Transition: '<S5>:7' */
        RotAngObs_FlgPosErrShtDwn = FALSE;
        Fu_RotAngObs_DWork.is_c1_Fu_RotAngObs = Fu_RotAngObs_IN_ANG_LERNING;

        /* Entry 'ANG_LERNING': '<S5>:6' */
        AngObs_StAngLern = 1U;
        Coord_IndRotPos = 0U;
      }
      break;
    }
  }

  /* End of Chart: '<S1>/Fu_RotAngObs_StatesMachine' */

  /* Sum: '<S4>/Add' incorporates:
   *  Inport: '<Root>/In8'
   */
  rtb_Add_k = (uint16_T)((uint32_T)MoCo_SpdStrtRamp + (uint32_T)AngObs_AngRamp);

  /* RelationalOperator: '<S4>/Relational Operator2' */
  rtb_RelationalOperator_f = (62832 <= rtb_Add_k);

  /* Switch: '<S4>/Switch' incorporates:
   *  Constant: '<S4>/Constant'
   *  Logic: '<S4>/Logical Operator'
   *  Memory: '<S4>/Memory1'
   *  RelationalOperator: '<S4>/Relational Operator'
   *  RelationalOperator: '<S4>/Relational Operator1'
   *  Switch: '<S4>/Switch1'
   */
  if ((Fu_RotAngObs_DWork.Memory1_PreviousInput_h == 1) && (1 !=
       AngObs_StAngLern)) {
    /* Update for Memory: '<S4>/Memory' */
    Fu_RotAngObs_DWork.Memory_PreviousInput = RotAngObs_AngHall;
  } else if (rtb_RelationalOperator_f) {
    /* Switch: '<S4>/Switch1' incorporates:
     *  Constant: '<S4>/Constant6'
     *  Update for Memory: '<S4>/Memory'
     */
    Fu_RotAngObs_DWork.Memory_PreviousInput = 0U;
  } else {
    /* Update for Memory: '<S4>/Memory' incorporates:
     *  Switch: '<S4>/Switch1'
     */
    Fu_RotAngObs_DWork.Memory_PreviousInput = rtb_Add_k;
  }

  /* End of Switch: '<S4>/Switch' */

  /* Update for Memory: '<S3>/Memory' incorporates:
   *  Inport: '<Root>/In1'
   */
  Fu_RotAngObs_DWork.Memory_PreviousInput_ch = Net_FlgHallSens1;

  /* Update for Memory: '<S3>/Memory1' incorporates:
   *  Inport: '<Root>/In2'
   */
  Fu_RotAngObs_DWork.Memory1_PreviousInput_c = Net_FlgHallSens2;

  /* Update for Memory: '<S3>/Memory2' incorporates:
   *  Inport: '<Root>/In3'
   */
  Fu_RotAngObs_DWork.Memory2_PreviousInput_m = Net_FlgHallSens3;

  /* Update for Memory: '<S4>/Memory2' incorporates:
   *  Constant: '<S4>/Constant1'
   *  Logic: '<S4>/Logical Operator1'
   *  RelationalOperator: '<S4>/Relational Operator3'
   *  Sum: '<S4>/Add1'
   */
  Fu_RotAngObs_DWork.Memory2_PreviousInput_o = (uint8_T)((uint32_T)
    (rtb_RelationalOperator_f && (AngObs_StAngLern != 0)) + (uint32_T)
    RotAngObs_NRamp);

  /* Update for Memory: '<S4>/Memory1' */
  Fu_RotAngObs_DWork.Memory1_PreviousInput_h = AngObs_StAngLern;
}

/* Model initialize function */
void Fu_RotAngObs_initialize(void)
{
  /* Registration code */

  /* initialize error status */
  rtmSetErrorStatus(Fu_RotAngObs_M, (NULL));

  /* block I/O */

  /* exported global signals */
  AngObs_AngRamp = 0U;
  RotAngObs_AngHall = 0U;
  RotAngObs_AngMdl = 0U;
  RotAngObs_SpdRaw = 0;
  RotAngObs_NRamp = 0U;
  AngObs_StAngLern = 0U;
  Coord_IndRotPos = 0U;
  RotAngObs_FlgHallAngVld = FALSE;
  RotAngObs_FlgPosErrShtDwn = FALSE;
  RotAngObs_FlgHallsensLernd = FALSE;
  RotAngObs_FlgAngLernd = FALSE;

  /* states (dwork) */
  (void) memset((void *)&Fu_RotAngObs_DWork, 0,
                sizeof(D_Work_Fu_RotAngObs));

  /* Start for Enabled SubSystem: '<S1>/Fu_RotAngObs_AngObsv' */
  /* InitializeConditions for Memory: '<S2>/Memory' */
  Fu_RotAngObs_DWork.Memory_PreviousInput_c = 0U;

  /* InitializeConditions for Memory: '<S2>/Memory2' */
  Fu_RotAngObs_DWork.Memory2_PreviousInput = 0U;

  /* InitializeConditions for Memory: '<S2>/Memory3' */
  Fu_RotAngObs_DWork.Memory3_PreviousInput = 0;

  /* InitializeConditions for Memory: '<S2>/Memory1' */
  Fu_RotAngObs_DWork.Memory1_PreviousInput = 0;

  /* InitializeConditions for Memory: '<S7>/Memory' */
  Fu_RotAngObs_DWork.Memory_PreviousInput_i = FALSE;

  /* End of Start for SubSystem: '<S1>/Fu_RotAngObs_AngObsv' */

  /* InitializeConditions for Chart: '<S3>/Fu_RotAngObs_Hallsensor_Calc' */
  Fu_RotAngObs_DWork.is_active_c2_Fu_RotAngObs = 0U;
  Fu_RotAngObs_DWork.is_c2_Fu_RotAngObs = 0U;
  Fu_RotAngObs_DWork.Loc_TblHallsens[0] = MAX_uint16_T;
  Fu_RotAngObs_DWork.Loc_TblHallsens[1] = MAX_uint16_T;
  Fu_RotAngObs_DWork.Loc_TblHallsens[2] = MAX_uint16_T;
  Fu_RotAngObs_DWork.Loc_TblHallsens[3] = MAX_uint16_T;
  Fu_RotAngObs_DWork.Loc_TblHallsens[4] = MAX_uint16_T;
  Fu_RotAngObs_DWork.Loc_TblHallsens[5] = MAX_uint16_T;
  Fu_RotAngObs_DWork.Loc_TblHallsens[6] = MAX_uint16_T;
  RotAngObs_AngHall = 0U;
  RotAngObs_FlgHallsensLernd = FALSE;

  /* InitializeConditions for Chart: '<S1>/Fu_RotAngObs_StatesMachine' */
  Fu_RotAngObs_DWork.is_active_c1_Fu_RotAngObs = 0U;
  Fu_RotAngObs_DWork.is_c1_Fu_RotAngObs = 0U;
  AngObs_StAngLern = 0U;
  RotAngObs_FlgPosErrShtDwn = FALSE;
  Coord_IndRotPos = 0U;
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
